package org.mics.core.config;

import javax.servlet.DispatcherType;

import org.mics.core.interceptor.ParamsFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 注册参数过滤器
 * @author mics
 * @date 2022-6-15
 * @version  1.0
 */
@Configuration
public class ParamFilterConfig {
	
	 @Bean
	    public FilterRegistrationBean<ParamsFilter> parmsFilterRegistration() {
	        FilterRegistrationBean<ParamsFilter> registration = new FilterRegistrationBean<ParamsFilter>();
	        registration.setDispatcherTypes(DispatcherType.REQUEST);
	        registration.setFilter(new ParamsFilter());
	        registration.addUrlPatterns("/*");
	        registration.setName("paramsFilter");
	        registration.setOrder(Integer.MAX_VALUE-1);
	        return registration;
	    }
}
